package com.zj.study.utils.validation.validator.length;


import com.zj.study.utils.validation.annotation.ValidateSupport;
import com.zj.study.utils.validation.annotation.constraint.Length;
import org.springframework.lang.NonNull;

/**
 * @author 谭耀飞
 * @since 2020.11.0
 */
@ValidateSupport(CharSequence.class)
public class LengthValidatorForCharSequence extends AbstractLengthValidator<CharSequence> {

  @Override
  boolean compare(@NonNull Length length, CharSequence value) {
    return length.min() <= value.length() && value.length() <= length.max();
  }

}
